using System;

namespace Atomic.Thermodynamics
{
	/// <summary>
	/// Represents the Helmholtz potential, i.e. the potential being minimized at thermal equilibrium when imposing constant temperature and volume.
	/// </summary>
	public interface IHelmholtzPotential
	{
		/// <summary>
		/// The free energy (eV) as a function of temperature (K) and volume (Å^3).
		/// </summary>
		double FreeEnergy(double temperature, double volume);

		/// <summary>
		/// The pressure (eV/Å^3) as a function of temperature (K) and volume (Å^3).
		/// This is also minus the partial derivative of the free energy with respect to volume.
		/// </summary>
		double Pressure(double temperature, double volume);

		/// <summary>
		/// The derivative of the pressures with respect to temperature (eV/Å^3/K) as a function of temperature (K) and volume (Å^3).
		/// The mixed derivative from the Maxwell relation. This is required to compute thermal expansion.
		/// </summary>
		double PressureTemperatureDerivative(double temperature, double volume);

		/// <summary>
		/// The bulk modulus (eV/Å^3) as a function of temperature (K) and volume (Å^3).
		/// This is also the volume multiplied the second order partial derivative of the free energy with respect to volume.
		/// </summary>
		double BulkModulus(double temperature, double volume);

		/// <summary>
		/// The volume (Å^3) at which the pressure (eV/Å^3, 1 eV/Å^3 = 160.2 GPa) is as specified.
		/// </summary>
		double EquilibriumVolume(double temperature, double pressure);

		/// <summary>
		/// Performs a Legendre transform to obtain the Gibbs potential.
		/// </summary>
		IGibbsPotential GibbsPotential
		{
			get;
		}
	}
}
